package chat.servlet;

import chat.asynch.AsyncRequestController;
import chat.message.ChatMessageManager;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class ContextInitializer implements ServletContextListener {
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        ChatMessageManager.start();
        AsyncRequestController.start();
    }

    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        AsyncRequestController.stop();
        ChatMessageManager.stop();
    }
}
